﻿package net.wangit.adm.monitor;

import net.wangit.MapList;
import net.wangit.support.MapListFactory;

public class MemoryMapListFactory implements MapListFactory {

	public MemoryMapListFactory() {
	}

	public MapList getMapList() {
		Runtime rt = Runtime.getRuntime();
		long max = rt.maxMemory();
		long total = rt.totalMemory();
		long free = rt.freeMemory();
		MapList list = new MapList();
		list.put(0, "y", (total - free) / 0x100000L);
		list.put(0, "c", "占用内存");
		list.put(1, "y", free / 0x100000L);
		list.put(1, "c", "闲置内存");
		list.put(2, "y", (max - total) / 0x100000L);
		list.put(2, "c", "可用内存");
		return list;
	}
}
